{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Custom Displayers and `jvm-repr`\n",
    "\n",
    "You can control the representation of a class using the Jupyter standard [`jvm-repr`](https://github.com/jupyter/jvm-repr) API.\n",
    "For example below we configure integers to be displayed with large heading text.\n",
    "See the [Tablesaw tutorial](Tablesaw.ipynb) and its [source code](https://github.com/jtablesaw/tablesaw/blob/master/beakerx/src/main/java/tech/tablesaw/beakerx/TablesawDisplayer.java) for a more substantial example that creates an interactive widget, not just HTML.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import jupyter.Displayer;\n",
    "import jupyter.Displayers;\n",
    "Displayers.register(Integer.class, new Displayer<Integer>() {\n",
    "      @Override\n",
    "      public Map<String, String> display(Integer value) {\n",
    "        return new HashMap<String, String>() {{\n",
    "          put(MIMEContainer.MIME.TEXT_HTML, \"<div><h1>\" + value + \"</h1></div>\");\n",
    "          \n",
    "        }};\n",
    "      }\n",
    "    });"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "1+1"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Groovy",
   "language": "groovy",
   "name": "groovy"
  },
  "language_info": {
   "codemirror_mode": "groovy",
   "file_extension": ".groovy",
   "mimetype": "",
   "name": "Groovy",
   "nbconverter_exporter": "",
   "version": "2.4.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
